﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Threading.Tasks;
using UI;
using ILRuntime;

public static class GameIniter
{
    private static bool bHaveInit=false;

    public static async Task InitAsync()
    {
        if (bHaveInit) return;
        bHaveInit = false;

        await ILRuntimeTools.Init();

        await InitDataAsync();
        await InitUIAsync();

        Debug.Log("初始化完毕");
    }

    private static async Task InitDataAsync()
    {
        await Item.ItemDataMgr.Ins.LoadTBLDataAsync();

        await Player.MyPlayer.Ins.InitAsync();
    }
    
    private static async Task InitUIAsync()
    {
        UIScience.Ins.Init();
        //await Task.Delay(10);
    }

    public static void OnDestory()
    {
        ILRuntimeTools.Destory();
    }
}
